

package com.class05.j_polymorphic;

public class NoteBook {
    //   特有方法
    public void start() {
        System.out.println("笔记本开机");
    }

    public void useUSB(USB usb) {
        if (usb instanceof Mouse) {
            Mouse mouse = (Mouse) usb;
            mouse.open();
            mouse.move();
            mouse.close();
        } else {
            KeyBoard keyBoard = (KeyBoard) usb;
            keyBoard.open();
            keyBoard.printWord();
            keyBoard.close();
        }
    }

    public void  stop (){
        System.out.println("笔记本关机");
    }

}
